package pl.edu.pk.mech.kkbus.component;

import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.validation.ValidatorFactory;
import javax.validation.Validation;
import javax.validation.Validator;

@Component
public class MyValidator {
 
    private static ValidatorFactory validatorFactory;
    
    @PostConstruct
    public void init() {
        validatorFactory = Validation.buildDefaultValidatorFactory();
    }
    
    public Validator getValidatorInstance() {
        return validatorFactory.getValidator();
    }
}
